# -*- coding: utf-8 -*-
# Author: xiantingDeng
# File: 05_存放家具.py
# Time: 18:53

class Home:
    def __init__(self, new_area, new_info, new_addr):
        self.area = new_area  # 房子的平方
        self.info = new_info  # 房子的房型
        self.addr = new_addr  # 在什么地方买的
        self.left_area = new_area
        self.contain_items = []

    def __str__(self):
        return f"房子的总面积是面积是：{self.area}。可用面积是：{self.left_area}," \
               f"户型是：{self.info}，地址是{self.addr},当前房子里的物品有：{self.contain_items}"

    def add_item(self,item):
        self.left_area -= item.area
        self.contain_items.append(item.name)

class Bed:
    def __init__(self, new_name, new_area):
        self.name = new_name
        self.area = new_area

    def __str__(self):
        return f"{self.name}占用面积是：{self.area}"

    def get_area(self):
        return self.area

    def get_name(self):
        return self.name



jia = Home(137, "四室一厅", "北京市 朝阳区 长安街 666号")

print(jia)

bed = Bed("席梦思", 4)
print(bed)

jia.add_item(bed)
print(jia)